﻿#ifndef _MSGSTRUCT_H_
#define _MSGSTRUCT_H_

#include "../basic/CMsg.h"
#include "../game/CSparePart.h"
#include "MiscDefine.h"


#ifdef __cplusplus
extern "C" {
#endif

//MSG_ID_KEY_PRESS_REQ
#define TOS_UPKEY		1
#define TOS_DOWNKEY		2
#define TOS_LEFTKEY		3
#define TOS_RIGHTKEY	4
typedef struct {
	CMsg msg;
	unsigned int user_id;
	unsigned int which_key;
} ST_KEY_PRESS_REQ;

//MSG_ID_KEY_PRESS_RES
typedef struct {
	CMsg msg;
	int user_id;
	unsigned int which_key;
} ST_KEY_PRESS_RES;

//#define MSG_ID_PILE_AUTO_DOWN_REQ				6

//#define MSG_ID_USR_READY_REQ					7
typedef struct {
	CMsg msg;
	int user_id;
} ST_USR_READY_REQ;

//MSG_ID_USR_READY_RES
typedef struct {
	CMsg msg;
	int user_id;
} ST_USR_READY_RES;

//MSG_ID_GAMESTART_CMD
typedef struct {
	CMsg msg;
} ST_GAMESTART_CMD;

//MSG_ID_USER_FIRST_NEXT
typedef struct {
	CMsg msg;
	int user_id;
	CSparePart spare_part;
} ST_USER_FIRST_NEXT;

//MSG_ID_USER_NEW_SPAREPART_NEXT
typedef ST_USER_FIRST_NEXT ST_USER_NEW_SPAREPART_NEXT;

//MSG_ID_DO_PILE_CMD
typedef struct {
	CMsg msg;
	unsigned short	user_id;
} ST_DO_PILE_CMD;

//MSG_ID_ERASE_FULL_ROW_CMD
typedef struct {
	CMsg msg;
	int row_cnt;
	char which_row[ITEM_HEIGHT_COUNT];
} ST_ERASE_FULL_ROW_CMD;

//#define MSG_ID_TEST_REQ							12
typedef struct {
	CMsg msg;
	char data[1];
} ST_TEST_REQ;

//#define MSG_ID_TEST_RES							13
typedef struct {
	CMsg msg;
	char data[1];
} ST_TEST_RES;

//#define MSG_ID_NEW_CONNECT_REQ						14
typedef struct {
	CMsg			msg;
	unsigned int	sock;
} ST_NEW_CONNECT_REQ;

//MSG_ID_NEW_CONNECT_RES
typedef struct {
	CMsg			msg;
	unsigned short	user_id;
	int game_user_count; //how many user will playing together
} ST_NEW_CONNECT_RES;

//MSG_ID_NOTIFY_NEW_USER_ADDED
typedef struct {
	CMsg msg;
	int user_id;
} ST_NOTIFY_NEW_USER_ADDED;

//MSG_ID_NOTIFY_CLIENT_SOCKET
typedef ST_NEW_CONNECT_REQ ST_NOTIFY_CLIENT_SOCKET;

//MSG_ID_SET_BTN
#define CMD_TYPE_BTN_SHOW	1
#define CMD_TYPE_BTN_HIDE	2
typedef struct {
	CMsg msg;
	int btn_id;
	int cmd_type;
} ST_SET_BTN;

//MSG_ID_NOTIFY_KEY_DOWN
typedef struct {
	CMsg msg;
	unsigned int key;
} ST_NOTIFY_KEY_DOWN;

//MSG_ID_NOTIFY_VIEW_ATOMS_CHANGED
typedef struct {
	CMsg msg;
	int atoms_count;
	TOS_ATOM atoms[1]; // real count depends on atoms_count
} ST_NOTIFY_VIEW_ATOMS_CHANGED;

#ifdef __cplusplus
}
#endif
#endif
